﻿@model DTOs.InvoiceDTO
@{
    ViewBag.Title = "Checkout";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript" src="../../Scripts/jquery.unobtrusive-ajax.min.js"></script>

<script type="text/javascript">
    $(document).ready(function () {

        $('#chkShip').click(function () {

            if ($(this).is(':checked')) {
                //alert("clicked");
                $("#shiptoname").val($("#contactname").val());
                $("#shiptoaddress1").val($("#contactaddress1").val());
                $("#shiptoaddress2").val($("#contactaddress2").val());
                $("#shiptocity").val($("#contactcity").val());
                $("#shiptostate").val($("#contactstate").val());
                $("#shiptozip").val($("#contactzip").val());
                $("#shiptoname").val($("#contactname").val());


                $.each($(".shipping"), function (index, value) {
                    //alert($(this).attr('disabled'));
                    $(this).attr("disabled", true);

                });
                
            }
            else {
                $.each($(".shipping"), function (index, value) {
                    //alert($(this).attr('disabled'));
                    $(this).removeAttr("disabled");

                });
            };
        });

    });

</script>

<h2>Checkout form</h2>


@using (Html.BeginForm())
{ 
<table class="table_form">
<tr>
<td>
<b> Billing Info : </b>

</td>
</tr>

<tr>
<td>
ContactName
</td>
<td>
                          <input id="contactname" name="ContactName" type="text" class="textfield2" value="" placeholder="Enter your name" >

@*@Html.TextBoxFor(Model => Model.ContactName, new { @id = "contactname" })*@
</td>
</tr>
<tr>
<td>
Model.ContactPhone
</td>
<td>
                          <input id="contactphone" name="ContactPhone" type="text" class="textfield2" placeholder="Enter your phone number" >

@*@Html.TextBoxFor(Model => Model.ContactPhone)*@
</td>
</tr>
<tr>
<td>
ContactEmail
</td>
<td>
                          <input id="contactemail" name="ContactEmail" type="email" class="textfield2" placeholder="Enter your email address" >

@*@Html.TextBoxFor(Model => Model.ContactEmail)*@
</td>
</tr>
<tr>
<td>
ContactAddress1
</td>
<td>
                          <input id="contactaddress1" name="ContactAddress1" type="text" class="textfield2" placeholder="Enter your email address" >
@*
@Html.TextBoxFor(Model => Model.ContactAddress1, new { @id = "contactaddress1" })*@
</td>
</tr>
<tr>
<td>
ContactAddress2
</td>
<td>
                          <input id="contactaddress2" name="ContactAddress2" type="text" class="textfield2" placeholder="Enter your email address" >
@*
@Html.TextBoxFor(Model => Model.ContactAddress2, new { @id = "contactaddress2" })*@
</td>
</tr>
<tr>
<td>
ContactCity
</td>
<td>
                          <input id="contactcity" name="ContactCity" type="text" class="textfield2" placeholder="Enter your email address" >
@*
@Html.TextBoxFor(Model => Model.ContactCity, new { @id = "contactcity" })*@
</td>
</tr>
<tr>
<td>
@Html.LabelFor(Model => Model.ContactStateProvince)
</td>
<td>
@Html.TextBoxFor(Model => Model.ContactStateProvince, new { @id = "contactstate" })
</td>
</tr>
<tr>
<td>
@Html.LabelFor(Model => Model.ContactZip)
</td>
<td>
@Html.TextBoxFor(Model => Model.ContactZip, new { @id = "contactzip" })
</td>
</tr>


</table>



<table class="table_form">
<tr>
<td>
<br />

<b>Ship To :</b>

<input type="checkbox" id="chkShip" value ="Same As Bill To" />
</td>
</tr>
<tr>
<td>
@Html.LabelFor(Model => Model.ShipToName)
</td>
<td>
@Html.TextBoxFor(Model => Model.ShipToName, new { @id = "shiptoname" , @class="shipping"})
</td>
</tr>

<tr>
<td>
@Html.LabelFor(Model => Model.ShipToAddress1)
</td>
<td>
@Html.TextBoxFor(Model => Model.ShipToAddress1, new { @id = "shiptoaddress1" , @class="shipping"})
</td>
</tr>

<tr>
<td>
@Html.LabelFor(Model => Model.ShipToAddress2)
</td>
<td>
@Html.TextBoxFor(Model => Model.ShipToAddress2, new { @id = "shiptoaddress2" , @class="shipping"})
</td>
</tr>
<tr>
<td>
@Html.LabelFor(Model => Model.ShipToCity)
</td>
<td>
@Html.TextBoxFor(Model => Model.ShipToCity, new { @id = "shiptocity" , @class="shipping"})
</td>
</tr>
<tr>
<td>
@Html.LabelFor(Model => Model.ShipToStateProvince)
</td>
<td>
@Html.TextBoxFor(Model => Model.ShipToStateProvince, new { @id = "shiptostate" , @class="shipping"})
</td>
</tr>
<tr>
<td>
@Html.LabelFor(Model => Model.ShipToZip)
</td>
<td>
@Html.TextBoxFor(Model => Model.ShipToZip, new { @id = "shiptozip" , @class="shipping"})
</td>
</tr>

</table>
    
    <input type="submit" value="PayPal checkout" />
    
}



